package com.yhny.lykj.yuhannongye.ui;

import android.view.View;
import android.widget.TextView;

import com.longsichao.lscframe.model.LSCModel;
import com.longsichao.lscframe.net.Api;
import com.yhny.lykj.yuhannongye.Adapter.MsgListAdapter;
import com.yhny.lykj.yuhannongye.R;
import com.yhny.lykj.yuhannongye.app.BaseRefreshListActivity;
import com.yhny.lykj.yuhannongye.app.BaseRefreshListAdapter;
import com.yhny.lykj.yuhannongye.model.MsgListModel;
import com.yhny.lykj.yuhannongye.net.NetHelper;

import java.util.List;

public class MsgListActivity extends BaseRefreshListActivity<MsgListModel.ListEntity> implements BaseRefreshListAdapter.OnItemClickListener {


    @Override
    protected int getLayoutResId() {
        return R.layout.activity_msg_list;
    }

    @Override
    protected void onSetContentViewAfter() {
        TextView textView = (TextView)findViewById(R.id.name_top_bar);
        textView.setText("消息中心");
        findViewById(R.id.left_text).setOnClickListener(this);
        findViewById(R.id.left_group).setOnClickListener(this);
    }

    @Override
    protected Api getApi(int page) {
        return NetHelper.Message.getNoticeList(page);
    }

    @Override
    protected Boolean isGridView() {
        return false;
    }

    @Override
    protected BaseRefreshListAdapter getRefreshListAdapter() {
        MsgListAdapter msgListAdapter =new MsgListAdapter(getDataList());
        msgListAdapter.setOnItemClickListener(this);
        return msgListAdapter;
    }

    @Override
    protected void setLayoutView() {

    }

    @Override
    protected List getModelDataList(LSCModel model) {
        MsgListModel msgListModel =(MsgListModel)model;
        return msgListModel.data;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.left_group:
            case R.id.left_text:{
                finish();
                break;
            }
        }
    }

    @Override
    public void onItemClick(int position) {

    }
}
